package com.start.pay.core;

import com.start.security.annotations.IgnoreAuth;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Tag(name = "支付平台回调")
@RequestMapping(StatPlatformNotifyController.START_ORDER_CALL_URL)
public class StatPlatformNotifyController {
    public static final String START_ORDER_CALL_URL = "/start/platform/notify";
    public static final String PAY_NOTIFY = "/payNotify";
    public static final String REFUND_NOTIFY = "/refundNotify";




    @IgnoreAuth
   @Operation(summary = "支付通知")
    @RequestMapping(START_ORDER_CALL_URL + PAY_NOTIFY + "/{platformType}/{appId}")
    public Object payNotify(@RequestParam("platformType") String platformType, @RequestParam("platformType") String appId, @RequestBody String callData) {
        return StartPayServerService.getInstance().payCallBack(platformType, appId, callData);
    }

    @IgnoreAuth
   @Operation(summary = "退款回调")
    @RequestMapping(START_ORDER_CALL_URL + REFUND_NOTIFY + "/{platformType}/{appId}")
    public Object refundNotify(@RequestParam("platformType") String platformType, @RequestParam("platformType") String appId, @RequestBody String callData) {
        return StartPayServerService.getInstance().refundCallBack(platformType, appId, callData);
    }
}
